Fix narrowing of intersection with function type#47483
Conversation
|
@typescript-bot test this |
|
Heya @DanielRosenwasser, I've started to run the extended test suite on this PR at e17ca56. You can monitor the build here. |
|
Heya @DanielRosenwasser, I've started to run the parallelized community code test suite on this PR at e17ca56. You can monitor the build here. |
|
Heya @DanielRosenwasser, I've started to run the perf test suite on this PR at e17ca56. You can monitor the build here. Update: The results are in! |
|
Heya @DanielRosenwasser, I've started to run the parallelized Definitely Typed test suite on this PR at e17ca56. You can monitor the build here. |
|
@DanielRosenwasser Here they are:Comparison Report - main..47483
System
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The user suite test run you requested has finished and failed. I've opened a PR with the baseline diff from master. |
|
I'm curious why you've included function test(x: number & { _foo: string }) {
if (typeof x === 'object') {
x; // Used to narrow to never, now doesn't
}
}It's fairly common to have tagged primitives like that, but they shouldn't appear to be objects. |
|
I think function f1(x: F & { foo: number }) {
if (typeof x !== "object") {
x; // Narrows to `never` if `TypeFacts.TypeofNEObject` is an `and` mask
}
}However, there's also a mistake on the Made the fixes here: #47583 |
Fixes #45801.
Second attempt at a fix, first is in #47282 (along with some explanation of the issue).